package com.xzan.medusa.core.manager.impl;

import com.xzan.medusa.common.query.PageResult;
import com.xzan.medusa.dal.model.CcCarDO;
import com.xzan.medusa.dal.query.CcCarQuery;
import com.xzan.medusa.dal.mapper.ext.CcCarExtMapper;
import com.xzan.medusa.core.manager.CcCarManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;


/**
 * Manager for CcCar.
 */

@Component
public class CcCarManagerImpl implements CcCarManager{

    
    @Autowired
    protected CcCarExtMapper ccCarExtMapper;
    /**
     * query count by query condition.
     */
    @Override
    public int countByQuery(CcCarQuery query){
        return ccCarExtMapper.countByQuery(query);
    }

    /**
     * delete by query condition.
     */
    @Override
    public int deleteByQuery(CcCarQuery query){
        return ccCarExtMapper.deleteByQuery(query);
    }

    /**
     * delete by primary key.
     */
    @Override
    public int deleteByPrimaryKey(CcCarDO record){
        return ccCarExtMapper.deleteByPrimaryKey(record);
    }

    /**
     * insert selective.
     */
    @Override
    public long insertSelective(CcCarDO record){
        return ccCarExtMapper.insertSelective(record);
    }

    /**
     * insert selective.
     */
    @Override
    public int batchInsert(List<CcCarDO> records){
        return ccCarExtMapper.batchInsert(records);
    }

    /**
     * select by query condition.
     */
    @Override
    public List<CcCarDO> selectByQuery(CcCarQuery query){
        return ccCarExtMapper.selectByQuery(query);
    }

    /**
     * select by query condition with page.
    */
    @Override
    public PageResult<CcCarDO> selectByQueryWithPage(CcCarQuery query) {
        PageResult<CcCarDO> result = new PageResult<CcCarDO>();
        result.setPageSize(query.getPageSize());
        result.setPageNo(query.getPageNo());
        result.setTotalCount(this.countByQuery(query));
        result.setResult(this.selectByQuery(query));
        return result;
    }

    /**
     * select by primary key.
     */
    @Override
    public CcCarDO selectByPrimaryKey(Long id){
        return ccCarExtMapper.selectByPrimaryKey(id);
    }

    /**
     * update by query condition selective.
     */
    @Override
    public int updateByQuerySelective( CcCarDO record,  CcCarQuery query){
        return ccCarExtMapper.updateByQuerySelective(record,  query);
    }

    /**
     * update by query condition.
     */
    @Override
    public int updateByQuery( CcCarDO record,  CcCarQuery query){

        return ccCarExtMapper.updateByQuery(record, query);
    }

    /**
     * update by primary key selective.
     */
    @Override
    public int updateByPrimaryKeySelective(CcCarDO record){
        return ccCarExtMapper.updateByPrimaryKeySelective(record);
    }
}